package com.example.yiqiuser.service.impl;


import com.example.yiqiuser.dao.ScenicTicketDao;
import com.example.yiqiuser.entity.ScenicTicket;
import com.example.yiqiuser.service.ScenicTicketService;
import com.example.yiqiuser.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ fileName:ScenicTicketServiceImpl
 * @ description:
 * @ author:chen
 * @ createTime:2023/3/30 11:12
 * @ version:1.0.0
 */
@Service
public class ScenicTicketServiceImpl implements ScenicTicketService {
    @Resource
    private ScenicTicketDao scenicTicketDao;

    /**
     * 分页查询
     * @param page
     * @return
     */
    @Override
    public PageInfo queryByParam(Page<ScenicTicket> page) {
        PageHelper.startPage(page.getPageNo(),page.getPageSize());
        PageInfo pageInfo = new PageInfo(scenicTicketDao.queryByParam(page.getData()));
        return pageInfo;
    }

    /**
     * 获取门票
     * @param id
     * @return
     */
    @Override
    public List<ScenicTicket> getTickets(int id) {
        return scenicTicketDao.getTickets(id);
    }

    /**
     * 添加
     * @param scenicTicket
     * @return
     */
    @Override
    public int add(ScenicTicket scenicTicket) {
        return scenicTicketDao.add(scenicTicket);
    }

    /**
     * 更新
     * @param scenicTicket
     * @return
     */
    @Override
    public int update(ScenicTicket scenicTicket) {
        return scenicTicketDao.update(scenicTicket);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    public int deleteById(String id) {
        return scenicTicketDao.deleteById(id);
    }


    @Override
    public ScenicTicket queryById(int id) {
        return scenicTicketDao.queryById(id);
    }
}
